home *** CD-ROM | disk | FTP | other *** search
- \ Atlas Plotter Driver:
- \ Laserjet II - Hewlett-Packard Printer Control Language (PCL)
- \
- \ File: PCL.ATL
- \
- \ Copyright (C) 1993 by Derrick Oswald
- \
- \ Derrick Oswald
- \ Nexsys Consulting Inc.
- \ 44 Douglas Drive
- \ Ayr, Ontario
- \ N0B 1E0
- \ (519) 632-8243
- \ (519) 632-8244 FAX
-
- \ Description:
- \ Example Hewlett-Packard Printer Control Language plotter driver
- \ for use with SEE versions greater than 26.78, and OVLY versions
- \ greater than 4.10. Written in ATLAS (Autodesk Threaded Language
- \ Application System) it demonstrates creating the required words
- \ to generate a plot and can be used as a template for further
- \ development.
- \
- \ For the program to use this driver 4 words must be defined:
- \
- \ "INITPLOTTER" - sets up any code or data required
- \ "CLEARPLOTTER" - initialize a new plot (form feed)
- \ "CLOSEPLOTTER" - shuts down the plotting system
- \ "IMAGEPLOTTER" - output one row of pixels
-
- : plotter ; \ use this word to forget this whole file
-
- .( "\nLoading PCL plotter driver"
-
- 300.0 2constant resolution
-
- \ X dimension set at 8.0" * 300 dpi = 2400
- 8.0 resolution f* fix constant maxdimx
- \ Y dimension set at 13.1667" * 300 dpi = 3950
- 13.1667 resolution f* fix constant maxdimy
-
- \ byte_width - convert number of bits to bytes
- : byte_width ( bits -> bytes )
- 7 + -3 shift
- ;
-
- DEVICE PCL
-
- \ declare the plotsize array
- 2 1 ptrsize realsize + realsize + array plotsize
-
- \ plotsize access words
- : &plotsize.name ( n -> addr ) plotsize ;
- : &plotsize.x ( n -> addr ) plotsize ptrsize + ;
- : &plotsize.y ( n -> addr ) plotsize ptrsize + realsize + ;
-
- .( "\nINITPLOTTER - set up code and data"
- : INITPLOTTER ( -> [PDEVICE pDevice] )
-
- OUTPUTIMAGE PCL ->Output !
- 0 PCL ->Left !
- maxdimx PCL ->Right !
- 0 PCL ->Top !
- maxdimy PCL ->Bottom !
- 10000 dup PCL ->Xasp ! PCL ->Yasp !
- 1 PCL ->Threshold !
- 1 PCL ->HiValue !
-
- "letter" 0 &plotsize.name !
- 8.0 0 &plotsize.x real!
- 10.5 0 &plotsize.y real!
- "MAX" 1 &plotsize.name !
- 8.0 1 &plotsize.x real!
- 13.1667 1 &plotsize.y real!
-
- -1 resolution 0 plotsize 2 PCL getuser
-
- if
- ." "\ncan't get user info"
- 0 \ return NULL
- else
- PCL \ return device structure
- then
- ;
-
- : IMAGEPLOTTER ( ImageData width line -> )
- drop \ drop line (redundant)
- "\e*b" outs \ prefix with number of bytes
- byte_width dup outn \ ( address bytecount bytecount -> )
- "W" outs
-
- \ send graphics data
- swap \ ( bytecount address -> )
- output
- ;
-
- \ reset - sends the reset code to the plotter
- : reset ( -> )
- "\eE" outs
- ;
-
- \ set_resolution - sets the raster resolution
- : set_resolution ( n -> )
- "\e*t" outs
- outn
- "R" outs
- ;
-
- \ formfeed - issues formfeed
- : formfeed ( -> )
- 12 outch
- ;
-
- .( "\nCLEARPLOTTER - initialize a new plot"
- : CLEARPLOTTER ( -> )
- reset \ reset defaults
-
- \ set graphics resolution
- resolution fix set_resolution
-
- "\e*r1A" outs \ start graphics
- ;
-
- .( "\nCLOSEPLOTTER - finish a plot"
- : CLOSEPLOTTER ( -> )
- "\e*rB" outs \ end graphics
- formfeed \ perform formfeed to eject paper
- ;
-
- .( "\nLoaded.\n"
-
-